﻿<UserControl x:Class="myCollections.UserControls.UcXxxInfo"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:utils="clr-namespace:myCollections.Utils"
    Loaded="UserControl_Loaded">
    <UserControl.Resources>
        <utils:TimeConverter x:Key="timeConverter"/>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="85"/>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
            <RowDefinition />
        </Grid.RowDefinitions>

        <TextBlock Text="{DynamicResource lblTitle}" Grid.Row="0" Grid.Column="0" Margin="5"/>
        <TextBox Name="txtTitle" Grid.Row="0" Grid.Column="1" Style="{DynamicResource requiredFieldValidationStyle}" Height="24"
                     Grid.ColumnSpan="3" Margin="0,3" TextChanged="txtTitle_TextChanged"  Text="{Binding Path=Title}" />
        
        <TextBlock Text="{DynamicResource lblBarcode}" Grid.Row="1" Grid.Column="0" Margin="5" ToolTip="{DynamicResource lblBarcode}"/>
        <StackPanel Grid.Row="1" Grid.Column="1"  Orientation="Horizontal">
            <TextBox Name="txtBarCode" Margin="0,3" Text="{Binding Path=BarCode}" Height="24" Width="115"
                 Style="{DynamicResource requiredFieldValidationStyle}" TextChanged="txtTitle_TextChanged"/>
            <Button ToolTip="{DynamicResource ScanBarCode}" Padding="0,0,0,0" Margin="0" Height="25" Width="25" Click="ScanButton_OnClick" 
                    Style="{DynamicResource ButtonStyle}" VerticalAlignment="Center">
                <Image Source="..\..\Images\BardcodeScanner.png"  />
            </Button>
        </StackPanel>

        <TextBlock Text="{DynamicResource NumId}" Grid.Row="1" Grid.Column="2" Margin="5" ToolTip="{DynamicResource NumIdToolTip}"/>
        <TextBox Grid.Row="1" Grid.Column="3" Margin="0,3" Text="{Binding Path=NumId}"/>

        <TextBlock Text="{DynamicResource PublicRating}" Grid.Row="2" Grid.Column="0" Margin="0,5,0,5" />
        <TextBox Grid.Row="2" Grid.Column="1" Margin="0,3" Text="{Binding Path=PublicRating}" />

        <TextBlock Text="{DynamicResource lblRating}" Grid.Row="2" Grid.Column="2" Margin="5"/>
        <ComboBox Name="cboRating" Grid.Row="2" Grid.Column="3" Margin="0,3"/>

        <TextBlock Text="{DynamicResource lblStudio}" Grid.Row="3" Grid.Column="0" Margin="5"/>
        <ComboBox Name="cboEditor" Grid.Row="3" Grid.Column="1" Margin="0,3" IsEditable="True" 
                  ItemsSource="{Binding}" DisplayMemberPath="Name"/>

        <TextBlock Text="{DynamicResource lblRunTime}" Grid.Row="3" Grid.Column="2" Margin="5"/>
        <TextBox Name="txtRuntime" Grid.Row="3" Grid.Column="3" Margin="0,3"  Text="{Binding Path=Runtime,Converter={StaticResource timeConverter}}"/>

        <TextBlock Text="{DynamicResource lblDescription}" Grid.Row="4" Grid.Column="0" Margin="5" ToolTip="{DynamicResource lblDescription}"/>
        <TextBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Margin="0,5"  VerticalContentAlignment="Top" 
                 TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" MaxLines="4" Height="72"
                 AcceptsReturn="True" Text="{Binding Path=Description}"/>

        <TextBlock Text="{DynamicResource lblLanguage}" Grid.Row="5" Grid.Column="0" Margin="5"/>
        <ComboBox Name="cboLanguage" Grid.Row="5" Grid.Column="1" Margin="0,3" IsEditable="True"
                  DisplayMemberPath="DisplayName" SelectedValuePath="Id"/>

        <TextBlock Text="{DynamicResource lblDateReleased}" Grid.Row="5" Grid.Column="2" Margin="5" ToolTip="{DynamicResource lblDateReleased}" />
        <TextBox Grid.Row="5" Grid.Column="3" Margin="0,3" Text="{Binding Path=ReleaseDate,StringFormat={}{0:d}}"/>

        <TextBlock Text="{DynamicResource lblMedia}" Grid.Row="6" Grid.Column="0" Margin="5"/>
        <ComboBox Name="cboMedia" Grid.Row="6" Grid.Column="1" Margin="0,3" />

        <TextBlock Text="{DynamicResource lblDateAdded}" Grid.Row="6" Grid.Column="2" Margin="5"/>
        <TextBox Grid.Row="6" Grid.Column="3" Margin="0,3" Text="{Binding Path=AddedDate,StringFormat={}{0:d}}"/>

        <TextBlock Text="{DynamicResource lblComments}" Grid.Row="7" Grid.Column="0" Margin="5" ToolTip="{DynamicResource lblComments}"/>
        <TextBox Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="3" Margin="0,5" VerticalAlignment="Stretch"
                     TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" MaxLines="4" Height="72"
                    AcceptsReturn="True" Text="{Binding Path=Comments}" />

        <TextBlock Text="{DynamicResource lblFileName}" Grid.Row="8" Grid.Column="0" Margin="5" ToolTip="{DynamicResource lblFileName}"/>
        <StackPanel Orientation="Horizontal" Grid.Row="8" Grid.Column="1" Grid.ColumnSpan="3" >
            <TextBox Name="txtFileName" Margin="0,3" Width="355" Text="{Binding Path=FileName}"/>
            <Button Name="cmdBrowseFile" Width="30" Height="25" Content="..." Margin="0,0" Padding="0" Click="cmdBrowseFile_Click"/>
            <Button ToolTip="{DynamicResource tltRename}" Padding="0,0,0,0" Margin="0,0" Height="25" Width="25" Click="cmdRename_Click" Style="{DynamicResource ButtonStyle}" 
                    VerticalAlignment="Center">
                <Image Source="..\..\Images\rename.png"  />
            </Button>
        </StackPanel>

        <TextBlock Text="{DynamicResource lblFilePath}" Grid.Row="9" Grid.Column="0" Margin="5" ToolTip="{DynamicResource lblFilePath}"/>
        <StackPanel Orientation="Horizontal" Grid.Row="9" Grid.Column="1" Grid.ColumnSpan="3">
            <TextBox Name="txtFilePath" Margin="0,3" Width="385" Text="{Binding Path=FilePath}"/>
            <Button Name="cmdBrowseFolder" Width="30" Height="25" Content="..." Margin="0,3" Padding="0" Click="cmdBrowseFolder_Click"/>
        </StackPanel>

        <TextBlock Text="{DynamicResource lblLinks}" Grid.Row="10"  Grid.Column="0" Margin="5"/>
        <ListBox Name="lstLinks"  Grid.Row="10" Grid.Column="1" Grid.ColumnSpan="3" Margin="0,3" Height="72"
                 MouseDoubleClick="lstLinks_MouseDoubleClick"  AlternationCount="1" KeyUp="lstLinks_KeyUp"
                  ToolTip="Double-Click the link to open the web page">
            <ListBox.ContextMenu>
                <ContextMenu Background="{DynamicResource ToolbarBackGroundColor}">
                    <ContextMenu.Effect>
                        <DropShadowEffect/>
                    </ContextMenu.Effect>
                    <MenuItem Header="{DynamicResource lblLinksDelete}" Name="mniDeleteAllLinks" Click="mniDeleteAllLinks_Click"/>
                    <MenuItem Header="{DynamicResource lblLinksAdd}" Name="mniAddLinks" Click="mniAddLinks_Click"/>
                </ContextMenu>
            </ListBox.ContextMenu>
        </ListBox>
        <ScrollViewer VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Auto" Grid.Row="11" Grid.ColumnSpan="4" Grid.Column="0" >
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">

                <TextBlock Text="{DynamicResource lblSeen}" Margin="5,3,5,7"/>
                <CheckBox Margin="0,3" IsChecked="{Binding Path=Watched}" />

                <TextBlock Text="{DynamicResource lblToWatch}" Margin="20,3,5,7"/>
                <CheckBox Margin="0,3" IsChecked="{Binding Path=ToWatch}" />

                <TextBlock Text="{DynamicResource lblComplete}" Margin="20,3,5,7"/>
                <CheckBox Margin="0,3" IsChecked="{Binding Path=IsComplete}" />

                <TextBlock Text="{DynamicResource lblWish}" Margin="20,3,5,7"/>
                <CheckBox Margin="0,3" IsChecked="{Binding Path=IsWhish}" />

                <TextBlock Text="{DynamicResource lblToBeDeleted}" Margin="20,3,5,7"/>
                <CheckBox Margin="0,3" IsChecked="{Binding Path=ToBeDeleted}" />

            </StackPanel>
        </ScrollViewer>
    </Grid>
</UserControl>
